package com.scott.java.lesson04;


/**
 * 
 * 练习：
 * 不考虑线程安全问题：使用Thread类。创建2个线程，共同打印 1-100
 * 
 */
public class ThreadTest {
	public static void main(String[] args) {
		
		
		//1: 创建线程对象
		FirstThread ft = new FirstThread("huanghoulin");
		
		//2:调用线程对象的start()方法启动线程
		ft.start();
		
		String threadName = Thread.currentThread().getName();
		for(int i=0; i<100000;i++){
			System.out.println(threadName+" : "+i);
		}
		
	}
}

class FirstThread extends Thread{
	
	public FirstThread(String name){
		super(name);
	}
	
	@Override
	public void run() {
		String threadName = Thread.currentThread().getName();
		for(int i=0; i<100000;i++){
			System.out.println(threadName+" : "+i);
		}
	};
}


